package com.gjy.sb.annotation;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-01-02 19:40:56
 */
@Aspect
@Component
public class CustomAnnotationProcessor {

    private static final Logger log = LoggerFactory.getLogger(CustomAnnotationProcessor.class);

    @Before("@annotation(myCustomAnnotation)")
    public void handleMyCustomAnnotation(CustomAnnotation myCustomAnnotation) {
        Map<String, Object> annotationAttributes = AnnotationUtils.getAnnotationAttributes(myCustomAnnotation);
        log.info("{}", annotationAttributes);
    }

}
